package com.kjlink.internal.report4vue.config;

import cn.xuqiudong.common.base.web.filter.RequestLoggerFilter;
import com.kjlink.internal.report4vue.base.controller.BaseApiController;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * 描述:
 * 配置一些过滤器
 *
 * @author Vic.xu
 * @since 2025-01-14 14:14
 */
@Configuration
public class FilterConfiguration {

    @Bean
    public FilterRegistrationBean<RequestLoggerFilter> secondFilterRegistration() {
        FilterRegistrationBean<RequestLoggerFilter> registrationBean = new FilterRegistrationBean<>();
        RequestLoggerFilter requestLoggerFilter = new RequestLoggerFilter();
        registrationBean.setFilter(requestLoggerFilter);
        registrationBean.addUrlPatterns(BaseApiController.V3_API_PREFIX + "/*");
        registrationBean.setName("SecondFilter");
        registrationBean.setOrder(2);
        return registrationBean;
    }
}
